package org.koyad.portal.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class LogUtils {
	
	private Logger _logger;
	
	private LogUtils(Logger logger){
		_logger = logger;
	}
	
	public void startMethod(String methodName){
		_logger.debug("Entering [" + methodName + "] ==========>");
	}
	
	public void endMethod(String methodName){
		_logger.debug("<========== Leaving [" + methodName + "]");
	}

	public static LogUtils getLogger(Class<?> cls) {
		return new LogUtils(LoggerFactory.getLogger(cls));
	}

	public void debug(String msg) {
		_logger.debug(msg);
	}
	
	public void info(String msg) {
		_logger.info(msg);
	}
	
	public void logException(Exception e) {
		_logger.error(e.getMessage(), e);
	}

	public boolean isDebugEnabled() {
		return _logger.isDebugEnabled();
	}
	
}
